package huanxin;

import com.jfinal.plugin.activerecord.Db;

import java.util.List;

/**
 * Created by Administrator on 2017/9/12 0012.
 */
public class HuanxinConsumer {
    public static void saveHuanxinId(Long userId) {
        String s1 = "update parents set id_disk = ?,update_time=now() where id = ?";
        String s2 = "update teacher set id_disk = ?, update_time=now() where id = ?";
        int i = Db.update(s1, userId, userId);
        if (i == 0) {
            Db.update(s2, userId, userId);
        }
        System.out.println("saveHuanxinId param is:" + userId);
    }

    public static void saveHuanxinIds(List<Long> userIds) {
        for (Long userId : userIds) {
            saveHuanxinId(userId);
        }
    }

    public static void update(Long classesId, String groupId) {
        String s = "update classes set id_disk = '" + groupId + "'" + " where id = " + classesId;
        Db.update(s);
    }
}
